﻿using System;
using System.Collections.Generic;
using AgileBoard.Domain;

namespace AgileBoard.Demo
{
    public class FakeIterationData
    {
        public static List<Iteration> CreateTestIterations()
        {
            int start = 28;
            int end = 42;

            var iterations = new List<Iteration>
                                 {
                                     Sprint1(),
                                     Sprint2(),
                                     Sprint3()
                                 };

            for (int i = 0; i < 10; i++)
            {
                var sampleIteration = new Iteration
                                          {
                                              IterationID = Guid.NewGuid(),
                                              ReleaseID = new Guid("2EBDBC36-3585-47b3-8709-BE3184956938"),
                                              Name = "New Iteration",
                                              PeriodFrom = DateTime.Now.AddDays(start + i),
                                              PeriodTo = DateTime.Now.AddDays(end + i),
                                              CreateTime = DateTime.Now
                                          };

                sampleIteration.AddStory(FakeStoryData.CreateTestStorys()[i]);

                //iterations.Add(sampleIteration);

                start++;
                end++;
            }

            return iterations;
        }

        public static Iteration DemoIteration()
        {
            var demo = new Iteration
                           {
                               IterationID = new Guid("29DC7A46-52B5-4941-AAE2-F48592847E42"),
                               ReleaseID = new Guid("29DC7A46-52B5-4941-AAE2-F48592847E42"),
                               Name = "demo iteration",
                               PeriodFrom = DateTime.Now,
                               PeriodTo = DateTime.Now.AddDays(13),
                               CreateTime = DateTime.Now
                           };

            FakeLabelData.CreateDemoLabels().ForEach(l => demo.AddLabel(l));

            demo.AddStory(FakeStoryData.DemoStory());

            return demo;
        }

        public static Iteration Sprint1()
        {
            var demo = new Iteration
                           {
                               IterationID = new Guid("25A996D0-842A-4bb3-A081-E0B762F9B4AB"),
                               ReleaseID = new Guid("3DFC646E-D49B-4c8c-84F0-B1FAFC105E47"),
                               Name = "Sprint 1",
                               PeriodFrom = DateTime.Now.RemoveDays(17),
                               PeriodTo = DateTime.Now.RemoveDays(4),
                               CreateTime = DateTime.Now
                           };

            FakeLabelData.CreateSprint1Labels().ForEach(l => demo.AddLabel(l));

            demo.AddStory(FakeStoryData.DemoStory1());
            demo.AddStory(FakeStoryData.DemoStory2());
            demo.AddStory(FakeStoryData.DemoStory3());
            demo.AddStory(FakeStoryData.DemoStory4());
            demo.AddStory(FakeStoryData.DemoStory5());

            return demo;
        }

        public static Iteration Sprint2()
        {
            var demo = new Iteration
                           {
                               IterationID = new Guid("8DD80B5B-CE96-4dd4-882D-2EAA1859C37F"),
                               ReleaseID = new Guid("3DFC646E-D49B-4c8c-84F0-B1FAFC105E47"),
                               Name = "Sprint 2",
                               PeriodFrom = DateTime.Now.RemoveDays(3),
                               PeriodTo = DateTime.Now.AddDays(9),
                               CreateTime = DateTime.Now
                           };

            FakeLabelData.CreateSprint2Labels().ForEach(l => demo.AddLabel(l));

            demo.AddStory(FakeStoryData.DemoStory6());
            demo.AddStory(FakeStoryData.DemoStory7());
            demo.AddStory(FakeStoryData.DemoStory8());
            demo.AddStory(FakeStoryData.DemoStory9());

            return demo;
        }

        public static Iteration Sprint3()
        {
            var demo = new Iteration
                           {
                               IterationID = new Guid("1A8ACB7C-CF3C-4977-81A1-8CCFBFD352FA"),
                               ReleaseID = new Guid("29DC7A46-52B5-4941-AAE2-F48592847E42"),
                               Name = "Sprint 3",
                               PeriodFrom = DateTime.Now.AddDays(10),
                               PeriodTo = DateTime.Now.AddDays(16),
                               CreateTime = DateTime.Now
                           };

            FakeLabelData.CreateSprint3Labels().ForEach(l => demo.AddLabel(l));

            demo.AddStory(FakeStoryData.DemoStory12());
            demo.AddStory(FakeStoryData.DemoStory13());
            demo.AddStory(FakeStoryData.DemoStory14());

            return demo;
        }

        public static Iteration DefaultIteration()
        {
            var Default = new Iteration
                              {
                                  IterationID = new Guid("BE4B0656-8685-439e-B4EA-66D5C9BA7508"),
                                  ReleaseID = new Guid("BE4B0656-8685-439e-B4EA-66D5C9BA7508"),
                                  Name = "default Iteration",
                                  PeriodFrom = DateTime.Now.AddDays(14),
                                  PeriodTo = DateTime.Now.AddDays(27),
                                  CreateTime = DateTime.Now
                              };

            FakeLabelData.CreateDefaultLabels().ForEach(l => Default.AddLabel(l));

            Default.AddStory(FakeStoryData.DefaultStory());

            return Default;
        }
    }
}